﻿<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="Bookmark" href="/favicon.ico" >
	<link rel="Shortcut Icon" href="/favicon.ico" />
	<!--[if lt IE 9]>
	{js href='/static/admin/lib/html5shiv.js,/static/admin/lib/respond.min.js'}
	<![endif]-->
	{css href='/static/admin/static/h-ui/css/H-ui.min.css,/static/admin/static/h-ui.admin/css/H-ui.admin.css,/static/admin/lib/Hui-iconfont/1.0.8/iconfont.css,/static/admin/static/h-ui.admin/skin/default/skin.css,/static/admin/static/h-ui.admin/css/style.css,/static/admin/static/gloab.css'}
	<!--[if IE 6]>
	{js href='/static/admin/lib/DD_belatedPNG_0.0.8a-min.js'}
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
	<title>用户列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户管理 <span class="c-gray en">&gt;</span> 用户列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form action="" method="get">
		<div class="text-c">
			新增日期范围：
			<input type="text" onfocus="WdatePicker({ maxDate:'#F{ $dp.$D(\'start_create_at\')||\'%y-%M-%d\' }' })" name="start_create_at" id="start_create_at" class="input-text Wdate" style="width:120px;" value="{$get|get='start_create_at'}" readonly>
			-
			<input type="text" onfocus="WdatePicker({ minDate:'#F{ $dp.$D(\'end_create_at\') }',maxDate:'%y-%M-%d' })" name="end_create_at" id="end_create_at" class="input-text Wdate" style="width:120px;" value="{$get|get='end_create_at'}" readonly>
			<input type="text" class="input-text" style="width:250px" placeholder="输入手机号码" name="mobile" value="{$get|get='mobile'}">
			<input type="text" class="input-text" style="width:250px" placeholder="输入账号" name="number" value="{$get|get='number'}">
			<span class="select-box inline">
				<select name="status" class="select">
					<option value="0">状态</option>
					{foreach $status as $key => $val}
						<option value="{$key}" {if get($get, 'status')!== ''&&get($get, 'status')!==NULL&&get($get, 'status') == $key}selected{/if}>{$val}</option>
					{/foreach}
				</select>
			</span>
			<button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜 索</button>
		</div>
	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="r">共有数据：<strong>{$count}</strong> 条</span> </div>
	<table class="table table-border table-bordered table-bg">
		<thead>
			<tr>
				<th scope="col" colspan="9">用户列表</th>
			</tr>
			<tr class="text-c">
				<th width="40">ID</th>
				<th width="150">昵称</th>
				<th width="90">手机号</th>
				<th width="90">账号</th>
				<th width="90">头像</th>
				<th width="90">性别</th>
				<th width="90">国家</th>
				<th width="90">省份</th>
				<th width="90">城市</th>
				<th width="130">注册时间</th>
				<th width="130">编辑时间</th>
				<th width="100">状态</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
			{volist name='list' id='info'}
				<tr class="text-c">
					<td>{$info.id}</td>
					<td>{if isset($info->userInfo->nickname)}{$info->userInfo->nickname}{else/}暂未登录{/if}</td>
					<td>{$info.mobile}</td>
					<td>{$info.number}</td>
					<td>{if isset($info->userInfo->head_url)}<img src="{$info->userInfo->head_url}" alt="{$info->userInfo->nickname}" style="width:40px;height:auto;" class="showImg" />{/if}</td>
					<td>{if isset($info->userInfo->gender_text)}{$info->userInfo->gender_text}{/if}</td>
					<td>{if isset($info->userInfo->country)}{$info->userInfo->country}{/if}</td>
					<td>{if isset($info->userInfo->province)}{$info->userInfo->province}{/if}</td>
					<td>{if isset($info->userInfo->city)}{$info->userInfo->city}{/if}</td>
					<td>{$info.create_at}</td>
					<td>{$info.update_at}</td>
					<td class="td-status"><span class="label {if $info.status eq 0}label-success{/if} radius">{$info.status_text}</span></td>
					<td class="td-manage">
						{if can('admin/user/Info/status')}
							<a style="text-decoration:none" {if $info.status==0}onClick="info_stop(this,'{$info.id}')"{else/}onClick="info_start(this,'{$info.id}')"{/if} href="javascript:;" title="{$info.status_text}">
								<i class="Hui-iconfont">{if $info.status eq 0}&#xe615;{else /}&#xe631;{/if}</i>
							</a>
						{/if}
						{if can('admin/user/Info/edit')}
							<a title="编辑" href="javascript:;" onclick="info_edit('用户编辑','/admin/user/info/{$info.id}/edit','{$info.id}','800','500')" class="ml-5" style="text-decoration:none">
								<i class="Hui-iconfont">&#xe6df;</i>
							</a>
						{/if}
					</td>
				</tr>
			{/volist}
		</tbody>
	</table>
	{$page|raw}
</div>
{js href="/static/admin/lib/jquery/1.9.1/jquery.min.js,/static/admin/lib/layer/2.4/layer.js,/static/admin/static/h-ui/js/H-ui.min.js,/static/admin/static/h-ui.admin/js/H-ui.admin.js"}
<!--请在下方写此页面业务相关的脚本-->
{js href='/static/admin/lib/My97DatePicker/4.8/WdatePicker.js,/static/admin/lib/datatables/1.10.0/jquery.dataTables.min.js,/static/admin/lib/laypage/1.2/laypage.js,/static/admin/static/gloab.js'}
<script type="text/javascript">
$(function(){
});
/*用户-编辑*/
function info_edit(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*用户-停用*/
function info_stop(obj,id){
	layer.confirm('确认要停用吗？',function(index){
		//此处请求后台程序，下方是成功后的前台处理……
		$.ajax({
			url:'/admin/user/info/status/'+id,
			method:'get',
			dataType:'json',
			success:function(data){
				$(obj).parents("tr").find(".td-manage").prepend('<a onClick="info_start(this,\''+id+'\')" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
				$(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">禁用</span>');
				$(obj).remove();
				layer.msg('已停用',{icon: 1,time:1000});
			},
            error:function(XmlHttpRequest, textStatus, errorThrown){
                let errstr = XmlHttpRequest.responseText;
                if ( errstr ) {
                    layer.msg($.parseJSON(errstr).message,{icon:5,time:1000});
                } else {
                    layer.msg('服务错误!',{icon:5,time:1000});
                }
            }
		});
		return false;
	});
}

/*用户-启用*/
function info_start(obj,id){
	layer.confirm('确认要启用吗？',function(index){
		//此处请求后台程序，下方是成功后的前台处理……
        $.ajax({
            url: '/admin/user/info/status/' + id,
            method: 'get',
            dataType: 'json',
            success: function (data) {
                $(obj).parents("tr").find(".td-manage").prepend('<a onClick="info_stop(this,\''+id+'\')" href="javascript:;" title="停用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
                $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">启用</span>');
                $(obj).remove();
                layer.msg('已启用!', {icon: 6,time:1000});
            },
            error:function(XmlHttpRequest, textStatus, errorThrown){
                let errstr = XmlHttpRequest.responseText;
                if ( errstr ) {
                    layer.msg($.parseJSON(errstr).message,{icon:5,time:1000});
                } else {
                    layer.msg('服务错误!',{icon:5,time:1000});
                }
            }
        })
	});
}
</script>
</body>
</html>